﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_DoiMatKhau : System.Web.UI.Page
{
    DataClassesDataContext data = new DataClassesDataContext();
    ConnectDB con = new ConnectDB();
    protected void Page_Load(object sender, EventArgs e)
    {
    
    }
    protected void lbtSave_Click(object sender, EventArgs e)
    {
        if (txtXacNhanMK.Text != txtMatKhauMoi.Text)
        {
            ScriptManager.RegisterStartupScript(this,
                this.GetType(),
                "redirectMe", "alert('Mật khẩu mới (xác nhận) không trùng với mật khẩu mới');",
                true);
        }
        else
        {
            string error = "";
            string msgv = Session["TenDangNhap"].ToString();
            data.spTB_DangNhap_DoiMatKhau(msgv, txtMatKhauCu.Text, txtMatKhauMoi.Text, ref error);
            //con.DoiMatKhau(Session["TenDangNhap"].ToString(), txtMatKhauCu.Text, txtMatKhauMoi.Text, ref error);
            if (error != "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "redirectMe", "alert('" + error + "')", true);
            }

        }
    }
}
